
public class BinarySearch {

	
	public static void main(String[] args) {
		
		int[] a = {-1,0,6,10,13,19,21,32,43,56,78,91,102};
		
		int x = 10;
		
		int l = 0;
		int r = a.length-1;
		int m;
		
		while(l <= r){
			m = (l+r)/2;
			if(a[m]== x){
				System.out.println("Element is found ad index :" + m);
				break;
			}
			
			if(a[m] > x){
				r = m - 1;
				
			} else{
				l = m + 1;
			}
		}
		
		if(l > r){
			System.out.println("Sorry element is not here");
		}

	}

}
